efl_version: 1 22;

collections {

   styles {
      style {
         name: "entry_style";
         base: "font="sans" font_size=10 color=#000 wrap="word" left_margin=2 right_margin=2";
      }
   }

   group {
      name: "example/main";
      min: 400 400;

      parts {
         part {
            name: "bg";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
            }
         }

         part {
            name: "title";
            type: TEXT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               color: 0 0 0 255;
               rel1 {
                  relative: 0.0 0.0;
                  offset: 0 0;
                  to: "bg";
               }
               rel2 {
                  relative: 1.0 0.2;
                  offset: -1 -1;
                  to: "bg";
               }
               text {
                  text: "Multiseat Filter Example";
                  size: 16;
                  font: "sans";
                  min: 1 1;
               }
            }
         }

         // focus_bt is important to test if focus action are
         // respecting allowed seats list
         part {
            name: "focus_bt";
            type: RECT;
            mouse_events: 1;
            description {
               state: "default" 0.0;
               rel1.relative: 0.3 0.2;
               rel2.relative: 0.7 0.25;
               color: 192 50 50 255;
            }
            description {
               state: "over" 0.0;
               inherit: "default" 0.0;
               color: 142 30 30 255;
            }
            description {
               state: "pressed" 0.0;
               inherit: "default" 0.0;
               color: 220 70 70 255;
            }
         }

         part {
            name: "focus_bt,label";
            type: TEXT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               color: 92 0 0 255;
               rel1 {
                  relative: 0.5 0.5;
                  to: "focus_bt";
               }
               rel2 {
                  relative: 0.5 0.5;
                  to: "focus_bt";
               }
               text {
                  text: "Focus 'Seat 1 Only' Entry";
                  size: 11;
                  font: "sans";
                  min: 1 1;
               }
            }
         }

         part {
            name: "widget1";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               rel1.relative: 0.0 0.3;
               rel2.relative: 0.5 0.65;
               color: 255 255 0 255;
            }
         }

         part {
            name: "widget2";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               rel1.relative: 0.0 0.65;
               rel2.relative: 0.5 1.0;
               color: 255 0 255 255;
            }
         }

         part {
            name: "widget3";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               rel1.relative: 0.5 0.3;
               rel2.relative: 1.0 0.65;
               color: 0 255 255 255;
            }
         }

         part {
            name: "widget4";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               rel1.relative: 0.5 0.65;
               rel2.relative: 1.0 1.0;
               color: 130 255 130 255;
            }
         }

         part {
           name: "widget1,title";
            type: TEXT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               color: 0 0 0 255;
               rel1 {
                  relative: 0.0 0.02;
                  offset: 0 0;
                  to: "widget1";
               }
               rel2 {
                  relative: 1.0 0.1;
                  offset: -1 -1;
                  to: "widget1";
               }
               text {
                  text: "Seat1 Only";
                  size: 10;
                  font: "sans";
                  min: 1 1;
               }
            }
         }

         part {
            name: "widget1,drag_area";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               color: 20 20 20 255;
               rel1 {
                  relative: 0.1 0.2;
                  offset: -5 0;
                  to: "widget1";
               }
               rel2 {
                  relative: 0.1 0.8;
                  offset: 4 0;
                  to: "widget1";
               }
            }
         }

         part {
            name: "widget,knob,1";
            type: RECT;
            mouse_events: 1;
            allowed_seats: "seat1";
            dragable {
               confine: "widget1,drag_area";
               x: 0 0 0;
               y: 1 1 0;
            }
            description {
               state: "default" 0.0;
               min: 10 30;
               color: 120 120 120 255;
            }
            description {
               state: "focused" 0.0;
               inherit: "default" 0.0;
               color: 200 200 200 255;
            }
         }

         part {
            name: "widget,bg_text,1";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               min: 10 50;
               rel1 {
                  to: "widget1";
                  relative: 0.25 0.2;
               }
               rel2 {
                  to: "widget1";
                  relative: 0.85 0.8;
               }
               color: 120 120 120 255;
            }
            description {
               state: "focused" 0.0;
               inherit: "default" 0.0;
               color: 200 200 200 255;
            }
         }

         part {
            name: "widget,text,1";
            type: TEXTBLOCK;
            scale: 1;
            entry_mode: EDITABLE;
            select_mode: DEFAULT;
            cursor_mode: UNDER;
            mouse_events: 1;
            allowed_seats: "seat1";
            multiline: 1;
            source: "example/selection";
            source4: "example/cursor";
            description {
               state: "default" 0.0;
               min: 12 50;
               rel1 {
                  to: "widget,bg_text,1";
                  offset: 2 2;
               }
               rel2 {
                  to: "widget,bg_text,1";
                  offset: -3 -3;
               }
               text {
                  style: "entry_style";
                  min: 0 1;
                  align: 0.0 0.0;
               }
            }
         }

        part {
           name: "widget2,title";
            type: TEXT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               color: 0 0 0 255;
               rel1 {
                  relative: 0.0 0.02;
                  offset: 0 0;
                  to: "widget2";
               }
               rel2 {
                  relative: 1.0 0.1;
                  offset: -1 -1;
                  to: "widget2";
               }
               text {
                  text: "Seat2 Only";
                  size: 10;
                  font: "sans";
                  min: 1 1;
               }
            }
         }

         part {
            name: "widget2,drag_area";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               color: 20 20 20 255;
               rel1 {
                  relative: 0.1 0.2;
                  offset: -5 0;
                  to: "widget2";
               }
               rel2 {
                  relative: 0.1 0.8;
                  offset: 4 0;
                  to: "widget2";
               }
            }
         }

         part {
            name: "widget,knob,2";
            type: RECT;
            mouse_events: 1;
            allowed_seats: "seat2";
            dragable {
               confine: "widget2,drag_area";
               x: 0 0 0;
               y: 1 1 0;
            }
            description {
               state: "default" 0.0;
               min: 10 30;
               color: 120 120 120 255;
            }
            description {
               state: "focused" 0.0;
               inherit: "default" 0.0;
               color: 200 200 200 255;
            }
         }

         part {
            name: "widget,bg_text,2";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               min: 10 50;
               rel1 {
                  to: "widget2";
                  relative: 0.25 0.2;
               }
               rel2 {
                  to: "widget2";
                  relative: 0.85 0.8;
               }
               color: 120 120 120 255;
            }
            description {
               state: "focused" 0.0;
               inherit: "default" 0.0;
               color: 200 200 200 255;
            }
         }

         part {
            name: "widget,text,2";
            type: TEXTBLOCK;
            scale: 1;
            entry_mode: EDITABLE;
            select_mode: DEFAULT;
            cursor_mode: UNDER;
            mouse_events: 1;
            allowed_seats: "seat2";
            multiline: 1;
            source: "example/selection";
            source4: "example/cursor";
            description {
               state: "default" 0.0;
               min: 12 50;
               rel1 {
                  to: "widget,bg_text,2";
                  offset: 2 2;
               }
               rel2 {
                  to: "widget,bg_text,2";
                  offset: -3 -3;
               }
               text {
                  style: "entry_style";
                  min: 0 1;
                  align: 0.0 0.0;
               }
            }
         }

        part {
           name: "widget3,title";
            type: TEXT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               color: 0 0 0 255;
               rel1 {
                  relative: 0.0 0.02;
                  offset: 0 0;
                  to: "widget3";
               }
               rel2 {
                  relative: 1.0 0.1;
                  offset: -1 -1;
                  to: "widget3";
               }
               text {
                  text: "Seat 1 + Seat2";
                  size: 10;
                  font: "sans";
                  min: 1 1;
               }
            }
         }

         part {
            name: "widget3,drag_area";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               color: 20 20 20 255;
               rel1 {
                  relative: 0.1 0.2;
                  offset: -5 0;
                  to: "widget3";
               }
               rel2 {
                  relative: 0.1 0.8;
                  offset: 4 0;
                  to: "widget3";
               }
            }
         }

         part {
            name: "widget,knob,3";
            type: RECT;
            mouse_events: 1;
            allowed_seats: "seat1" "seat2";
            dragable {
               confine: "widget3,drag_area";
               x: 0 0 0;
               y: 1 1 0;
            }
            description {
               state: "default" 0.0;
               min: 10 30;
               color: 120 120 120 255;
            }
            description {
               state: "focused" 0.0;
               inherit: "default" 0.0;
               color: 200 200 200 255;
            }
         }

         part {
            name: "widget,bg_text,3";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               min: 10 50;
               rel1 {
                  to: "widget3";
                  relative: 0.25 0.2;
               }
               rel2 {
                  to: "widget3";
                  relative: 0.85 0.8;
               }
               color: 120 120 120 255;
            }
            description {
               state: "focused" 0.0;
               inherit: "default" 0.0;
               color: 200 200 200 255;
            }
         }

         part {
            name: "widget,text,3";
            type: TEXTBLOCK;
            scale: 1;
            entry_mode: EDITABLE;
            select_mode: DEFAULT;
            cursor_mode: UNDER;
            mouse_events: 1;
            allowed_seats: "seat1" "seat2";
            multiline: 1;
            source: "example/selection";
            source4: "example/cursor";
            description {
               state: "default" 0.0;
               min: 12 50;
               rel1 {
                  to: "widget,bg_text,3";
                  offset: 2 2;
               }
               rel2 {
                  to: "widget,bg_text,3";
                  offset: -3 -3;
               }
               text {
                  style: "entry_style";
                  min: 0 1;
                  align: 0.0 0.0;
               }
            }
         }

        part {
           name: "widget4,title";
            type: TEXT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               color: 0 0 0 255;
               rel1 {
                  relative: 0.0 0.02;
                  offset: 0 0;
                  to: "widget4";
               }
               rel2 {
                  relative: 1.0 0.1;
                  offset: -1 -1;
                  to: "widget4";
               }
               text {
                  text: "Any seat";
                  size: 10;
                  font: "sans";
                  min: 1 1;
               }
            }
         }

         part {
            name: "widget4,drag_area";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               color: 20 20 20 255;
               rel1 {
                  relative: 0.1 0.2;
                  offset: -5 0;
                  to: "widget4";
               }
               rel2 {
                  relative: 0.1 0.8;
                  offset: 4 0;
                  to: "widget4";
               }
            }
         }

         part {
            name: "widget,knob,4";
            type: RECT;
            mouse_events: 1;
            dragable {
               confine: "widget4,drag_area";
               x: 0 0 0;
               y: 1 1 0;
            }
            description {
               state: "default" 0.0;
               min: 10 30;
               color: 120 120 120 255;
            }
            description {
               state: "focused" 0.0;
               inherit: "default" 0.0;
               color: 200 200 200 255;
            }
         }

         part {
            name: "widget,bg_text,4";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               min: 10 50;
               rel1 {
                  to: "widget4";
                  relative: 0.25 0.2;
               }
               rel2 {
                  to: "widget4";
                  relative: 0.85 0.8;
               }
               color: 120 120 120 255;
            }
            description {
               state: "focused" 0.0;
               inherit: "default" 0.0;
               color: 200 200 200 255;
            }
         }

         part {
            name: "widget,text,4";
            type: TEXTBLOCK;
            scale: 1;
            entry_mode: EDITABLE;
            select_mode: DEFAULT;
            cursor_mode: UNDER;
            mouse_events: 1;
            multiline: 1;
            source: "example/selection";
            source4: "example/cursor";
            description {
               state: "default" 0.0;
               min: 12 50;
               rel1 {
                  to: "widget,bg_text,4";
                  offset: 2 2;
               }
               rel2 {
                  to: "widget,bg_text,4";
                  offset: -3 -3;
               }
               text {
                  style: "entry_style";
                  min: 0 1;
                  align: 0.0 0.0;
               }
            }
         }
      }

      programs {
         program {
            name: "clicked";
            signal: "seat,*,mouse,clicked,1";
            source: "widget,text,*";
            script {
                new seat[256];
                new partid, idx;

                idx = strchr(sig[strlen("seat,")], ",");
                strncpy(seat, sig[strlen("seat,")], idx);

                partid = get_part_id(src);
                set_focus(partid, seat);
            }
         }

         program {
            name: "focused";
            signal: "seat,*,focus,part,in";
            source: "widget,text,*";
            script {
               new buf[256];
               new partid;

               snprintf(buf, sizeof(buf), "widget,bg_text,%s",
                        src[strlen("widget,text,")]);
               partid = get_part_id(buf);
               set_state(partid, "focused", 0.0);
            }
         }

         program {
            name: "unfocused";
            signal: "seat,*,focus,part,out";
            source: "widget,text,*";
            script {
               new buf[256];
               new partid;

               snprintf(buf, sizeof(buf), "widget,bg_text,%s",
                        src[strlen("widget,text,")]);
               partid = get_part_id(buf);
               set_state(partid, "default", 0.0);
            }
         }

         program {
            name: "drag,start";
            signal: "seat,*,drag,start";
            source: "widget,knob,*";
            script {
                new partid;
                partid = get_part_id(src);
                set_state(partid, "focused", 0.0);
            }
         }

         program {
            name: "drag,stop";
            signal: "seat,*,drag,stop";
            source: "widget,knob,*";
            script {
                new partid;
                partid = get_part_id(src);
                set_state(partid, "default", 0.0);
            }
         }

         program {
            name: "focus_bt,in";
            signal: "mouse,in";
            source: "focus_bt";
            action: STATE_SET "over" 0.0;
            target: "focus_bt";
         }

         program {
            name: "focus_bt,out";
            signal: "mouse,out";
            source: "focus_bt";
            action: STATE_SET "default" 0.0;
            target: "focus_bt";
         }

         program {
            name: "focus_bt,down";
            signal: "mouse,down,1";
            source: "focus_bt";
            action: STATE_SET "pressed" 0.0;
            target: "focus_bt";
         }

         program {
            name: "focus_bt,up";
            signal: "mouse,up,1";
            source: "focus_bt";
            action: STATE_SET "default" 0.0;
            target: "focus_bt";
         }

         program {
            name: "focus_bt,clicked";
            signal: "seat,*,mouse,clicked,1";
            source: "focus_bt";
            script {
                new seat[256];
                new idx;

                idx = strchr(sig[strlen("seat,")], ",");
                strncpy(seat, sig[strlen("seat,")], idx);

                set_focus(PART:"widget,text,1", seat);
            }
         }
      }
   }

   group {
      name: "example/selection";

      parts {
         part {
            name: "selection";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               color: 180 180 180 255;
            }
         }
      }
   }

   group {
      name: "example/cursor";
      min: 1 0;

      parts {
         part {
            name: "cursor";
            type: RECT;
            mouse_events: 0;
            description {
               state: "default" 0.0;
               min: 2 12;
               color: 0 0 0 255;
            }
            description {
               state: "hidden" 0.0;
               inherit: "default" 0.0;
               color: 0 0 0 0;
            }
         }
      }

      programs {
         program {
            name: "cursor_hide";
            signal: "load";
            source: "";
            action: STATE_SET "hidden" 0.0;
            target: "cursor";
            transition: SINUSOIDAL 0.2;
            after: "cursor_hide_timer";
         }
         program {
            name: "cursor_hide_timer";
            in: 0.2 0.0;
            after: "cursor_show";
         }
         program {
            name: "cursor_show";
            action: STATE_SET "default" 0.0;
            target: "cursor";
            after: "cursor_show_timer";
         }
         program {
            name: "cursor_show_timer";
            in: 0.5 0.0;
            after: "cursor_hide";
         }
      }
   }
}
